package com.example.directoryoperations.unit10;

import java.io.*;
 
class Main {
   public static void main(String[] args) {
      File dir = new File("F:");
       dir.listFiles();
       File[] files;
      FileFilter fileFilter = File::isDirectory;
      files = dir.listFiles(fileFilter);
       assert files != null;
       System.out.println(files.length);
      if (files.length == 0) {
         System.out.println("目录不存在或它不是一个目录");
      }
      else {
          for (File filename : files) {
              System.out.println(filename.toString());
          }
      }
   }
}